#include<stdio.h>
#include<stdlib.h>
#include<sys/wait.h>
#include<unistd.h>


int main()
{
    
    pid_t ret = fork();    
    if(ret == 0)  //child process
    {
        int i = 5;
        while(i--)
        {
            fprintf(stdout,"I'm child process !!!\n");
            fflush(stdout);
            sleep(1);
            int a = 9/0;
            exit(23);
        }
    }
    else
    {
        pid_t status = -1;
        // wait(&status);
        // printf("child exits successfully , exit status = %d", status);
        waitpid(-1 , &status , 0);
        printf("exit status = %d\n exit signal =  %d\n core dump = %d\n" , 
            WEXITSTATUS(status),
            WIFSIGNALED(status),
            WCOREDUMP(status)); // not END
            
    }

    

    return 0;
}